
<script type="text/javascript" src="<?php $this->path('js/highcharts.js');?>"></script>
<script type="text/javascript" src="<?php $this->path('js/jquery.highchartTable.js');?>"></script>
<script type="text/javascript" src="<?php $this->path('js/selectBox.js');?>"></script>
		<section id="main" class="entire_width">
			<div class="container_12">
				<div id="content" class="grid_9" style="width:90%;">
        			<h1 class="page_title">Reports and Statistics</h1>
						<div class="options" style="width:100%">
							<div class="sort">
								<form class="form_style" style="padding:0px;">
									<input id="print-button" type="button" value="Print" />
								</form>
							</div>

							
            				<div class="search-bar">
								<form class="form_style" style="padding:0px;">
									<input id="back-button" type="button" value="Back" />
								</form>							    
    						</div>
                	</div><!-- .options -->
        				<div class="forprint">
    
<table>	
				  <br><h1><center>Creditors</center></h1>
                  <thead>
                      <tr>
                          <th>Name</th>
                          <th>Balance</th>
						  <th>Lending Date</th>
						  <th>Interest</th>
                      </tr>
                   </thead>
                   <tbody>
		
<?php
				
			$from_stamp = strtotime($from);
            $to_stamp = strtotime($to);
			$sql = "SELECT name, balance, date, interest from item_sales_credit";
       		Connection::setQuery($sql);
			while(true) {
				$result = Connection::fetch();
				if (!$result) {
				   break;
				}
				?>
				<tr class="list">
				<td><?php echo $result[0]; ?> </td>
				<td><?php echo $result[1]; ?> </td>
				<td><?php echo $result[2]; ?> </td>
				<td><?php echo $result[3]; ?> </td>
				
				</tr>
				<?php
				}
		
?>	
</table>	
				
						</div>
        				<div class="clear"></div>
        				<br />
        				<div class="clear"></div>
		</section>
        <div class="clear"></div>
<script>
			$('#branding #site_logo').parent().parent().css('margin-top','-40px').show();
			$('#branding #cart_nav').hide();
			$('#branding .grid_3 .search').hide();
			$('#branding .private ul').children().hide();
			$('#branding .private ul li:nth-child(5)').show();
			$('#branding .private ul li:nth-child(6)').show();
			
			$('#block_nav_primary').css('background', '#f5f7f9');
			$('#branding .private ul li:last-child').show().parent().parent().css({"margin-right": "-260px", "margin-top": "-5px"}).parent().css('height','10px');
			$('header#branding').css('height','50px');
			$('.phone_top').parent().css('visibility','hidden');
			$('#header-top').hide().parent().css('padding-top','10px');
$(function() {
			var printReport = function (html){  
				var styles = '<style tyle="text/css">@page { size:8in 11in; margin: 1in; } body div:first-child {position:relative;margin-left:auto;margin-right:auto;} table, tr, td{ font-size:125px; }</style>';
				if($('#tdisplay').val() != 'table') 
					var styles = '<style tyle="text/css">@page { size:11in 8in; margin: 1in; } body div:first-child {position:relative;margin-left:auto;margin-right:auto;} }</style>';
				var printWin = window.open('','','left=0,top=0,width=1000,height=800,toolbar=0,scrollbars=0,status  =0');
				printWin.document.write("<html><body style='background:none;padding:1in;'>" + styles + html + "</body></html>");
				printWin.document.close();
				printWin.focus();
				printWin.print();
				printWin.close();
            }
			
	$("#print-button").click(function() {
	     printReport($('.forprint').html());	
	});			
	$("#back-button").click(function() {
	    window.location = "?module=pos&action=reports";
	});
});
</script>